﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QDebug>
#include <QPrinterInfo>
#include <QPrinter>
#include <QPainter>
#include <QDebug>
#include <QUdpSocket>
#include <QTimer>
#include <QTextCodec>
#include <QThread>
#include "dlgcard.h"
#include "dialog.h"
#include "Msprintsdk.h"
#include <QLibrary>
#include <QFileInfo>
typedef int (*SetReadZKmode)(int mode);
typedef int (*GetProductinformation)(int iFstyle,char *bFiddata,int iFidlen);
typedef int (*PrintDiskimgfile)(char *);
typedef int (*PrintChangeRow)();
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

signals:
    void signalDlgcardShow(QString);
    void signalParseJson(QString szJson);
    void signalExit();
    //
    void signalDlgShow(QString, QString, QString, QString);
    void signalSearch(QString, QString);
    void signalPrint();
    void signalTicketPrint(QString,QString,QString,QString,QString,int,QString);
private slots:
    void slotUdpRecvData();
    void slotParseJson(QString szJson);
    void slotExit();
    void slotSearch(QString name, QString tel);
    void slotTicketPrint(QString,QString,QString,QString,QString,int,QString);
    void on_pushButton_clicked();

public:

    void Init();
    void printInfo();
private:
    void initTicketPrinterDll();
    void printTicketInfo(QString , QString , QString , QString , QString , int , QString );
    void convertImageTo24Bmp();
    QPrinter    *m_printer;
    QPainter    m_painter;
    QUdpSocket  *m_udpSocket;
    dlgcard     *m_dlgcard;
    Dialog  *m_dlg;
    QPixmap *m_pixmap;
    //
    QString m_szCfgFileName;
    int m_nType;

    QUdpSocket udptest;
private:
    QLibrary        *m_ploadChat;
    SetPrintport    m_SetPrintport;
    SetUsbportauto  m_SetUsbportauto;
    SetInit         m_SetInit;
    SetClean        m_SetClean;
    SetClose        m_SetClose;
    SetAlignment    m_SetAlignment;
    SetSizetext     m_SetSizetext;
    SetSizechar     m_SetSizechar;
    SetSizechinese  m_SetSizechinese;
    SetLinespace    m_SetLinespace;
    SetBold         m_SetBold;
    SetSpacechar    m_SetSpacechar;
    SetSpacechinese m_SetSpacechinese;
    SetNvbmp        m_SetNvbmp;
    SetMarkoffsetcut    m_SetMarkoffsetcut;
    SetMarkoffsetprint  m_SetMarkoffsetprint;
    SetLeftmargin       m_SetLeftmargin;
    SetDirection        m_SetDirection;
    SetItalic           m_SetItalic;
    SetRotate           m_SetRotate;
    SetWhitemodel       m_SetWhitemodel;
    SetReadZKmode       m_SetReadZKmode;

    PrintSelfcheck      m_PrintSelfcheck;
    PrintString         m_PrintString;
    PrintFeedline       m_PrintFeedline;
    PrintCutpaper       m_PrintCutpaper;
    PrintQrcode         m_PrintQrcode;
    PrintRemainQR       m_PrintRemainQR;
    PrintQRcode500II    m_PrintQRcode500II;
    Print1Dbar          m_Print1Dbar;
    PrintPdf417         m_PrintPdf417;
    PrintDiskbmpfile    m_PrintDiskbmpfile;
    PrintNvmbp          m_PrintNvmbp;
    PrintMarkposition   m_PrintMarkposition;
    PrintMarkcutpaper   m_PrintMarkcutpaper;
    PrintTransmit       m_PrintTransmit;
    SetPagemode         m_SetPagemode;
    PrintPagedata       m_PrintPagedata;
    SetPagestartposition    m_SetPagestartposition;

    GetTransmit         m_GetTransmit;
    GetStatus           m_GetStatus;
    GetProductinformation   m_GetProductinformation;
    PrintDiskimgfile    m_PrintDiskimgfile;
    PrintChangeRow    m_PrintChangeRow;
private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H
